package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-09-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_integral_log")
@ApiModel(value = "IntegralLog", description = "")
public class IntegralLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableId(value = "id", type = IdType.AUTO)
    @Excel(name = "")
    private Long id;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("customer_id")
    @Excel(name = "")
    private Long customerId;

    @ApiModelProperty(value = "")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "phone_no", condition = LIKE)
    @Excel(name = "")
    private String phoneNo;

    /**
     * 1贡献值2拼团值
     */
    @ApiModelProperty(value = "1贡献值2拼团值")
    @TableField("integral_type")
    @Excel(name = "1贡献值2拼团值")
    private Integer integralType;

    /**
     * 关联订单号
     */
    @ApiModelProperty(value = "关联订单号")
    @Length(max = 50, message = "关联订单号长度不能超过50")
    @TableField(value = "order_no", condition = LIKE)
    @Excel(name = "关联订单号")
    private String orderNo;

    @ApiModelProperty(value = "")
    @TableField("integral_num")
    @Excel(name = "")
    private BigDecimal integralNum;

    @ApiModelProperty(value = "")
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    @Excel(name = "", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    /**
     * 账户余额
     */
    @ApiModelProperty(value = "账户余额")
    @TableField("balance")
    @Excel(name = "账户余额")
    private BigDecimal balance;

    @ApiModelProperty(value = "")
    @TableField("price_id")
    @Excel(name = "")
    private Long priceId;

    @ApiModelProperty(value = "")
    @Length(max = 100, message = "长度不能超过100")
    @TableField(value = "price_title", condition = LIKE)
    @Excel(name = "")
    private String priceTitle;


    @Builder
    public IntegralLog(
                    Long id, Long customerId, String phoneNo, Integer integralType, String orderNo, 
                    BigDecimal integralNum, LocalDateTime createDate, BigDecimal balance, Long priceId, String priceTitle) {
        this.id = id;
        this.customerId = customerId;
        this.phoneNo = phoneNo;
        this.integralType = integralType;
        this.orderNo = orderNo;
        this.integralNum = integralNum;
        this.createDate = createDate;
        this.balance = balance;
        this.priceId = priceId;
        this.priceTitle = priceTitle;
    }

}
